<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/init.jsp"%>
<script src="<c:url value='/resources/js/jquery-1.7.2.min.js"'/>"></script>
<link href="<c:url value='/admin/css/custom.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/admin/css/style.css'/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/My97DatePicker/WdatePicker.js'/>"></script>
<style type="text/css">
<!--
body {
	background: #ffffff;
	margin-top:10px;
	margin-left:5px;
	margin-right:5px;
}
-->
</style>
<div class="EpmsSubTitle"><p><b>股票买卖（手动售出）</b></p></div>
<form method="post" action="listNum.action" id="stockSBForm">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="EpmsTable">
	    <tr>
		    <td class=EpmsTdTitle >会员ID：</td>
		    <td class=EpmsTdNoColor >
		    	<input type="text" name="userid" style="width:120"/> 
		    </td>
		    <td class=EpmsTdTitle >会员级别：</td>
		    <td class=EpmsTdNoColor >
		    	<select name="level">
		    		<option value="0">所有</option>
		    		<option value="1">1</option>
		    		<option value="2">2</option>
		    		<option value="3">3</option>
		    		<option value="4">4</option>
		    		<option value="5">5</option>
		    		<option value="6">6</option>
		    		<option value="7">7</option>
		    	</select>
		    </td>
		    <td class=EpmsTdTitle >买卖：</td>
		    <td class=EpmsTdNoColor >
		    	<select name="tradeType">
		    		<option value="1">所有（默认）</option>
		    		<option value="2">买入（自由交易）</option>
		    		<option value="3">卖出（自由交易）</option>
		    		<option value="4">买入（公司交易）</option>
		    		<option value="5">卖出（公司交易）</option>
		    	</select>
		    </td>
	    </tr>
		<tr>
		    <td class=EpmsTdTitle >价格：</td>
		    <td class=EpmsTdNoColor >
		    	<input type="text" name="startprice" style="width:80"/> ~
		    	<input type="text" name="endprice" style="width:80"/>
		    </td>
		    <td class=EpmsTdTitle >状态：</td>
		    <td class=EpmsTdNoColor >
		    	<select name="status">
		    		<option value="1">所有（默认）</option>
		    		<option value="2">未完成</option>
		    		<option value="3">完成</option>
		    		<option value="4">取消</option>
		    	</select>
		    </td>
		    <td class=EpmsTdTitle >时间：</td>
		    <td class=EpmsTdNoColor >
		    	<input name="starttime" type="text" class="text" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:80"/>~
		    	<input name="endtime" type="text" class="text"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:80"/>
		    </td>
		</tr>
		<tr>
			<td class=EpmsTdTitle >身份证：</td>
		    <td class=EpmsTdNoColor >
		    	<input type="text" name="card" style="width:180"/>
		    </td>
		    <td class=EpmsTdTitle >姓名：</td>
		    <td class=EpmsTdNoColor >
		    	<input type="text" name="name" style="width:80"/>
		    </td>
		    <td class=EpmsTdTitle >持股数：</td>
		    <td class=EpmsTdNoColor >
		    	<input type="text" name="startnum" style="width:80" value="0"/>~
		    	<input type="text" name="endnum" style="width:80" value="100000000"/>
		    </td>
		</tr>
		<tr>
		    <td class=EpmsTdTitle colspan="6">
		    	<input type="submit" value="点击搜索"/> 
		    </td>
		</tr>
		<tr>
		    <td class=EpmsTdTitle colspan="6">
			    售出数量(如果输入数据小于1表示比例,比如输入0.1表示售出会员持股的10%)：
					<input type="text" name="per" style="width:80" value="0"/>
				售出价格： <input type="text" name="saleprice" style="width:80" value="0"/>
				<input type="button" value="确认售出" id="stockSale1"/> 
		    </td>
		</tr>
		<tr>
		    <td class=EpmsTdTitle colspan="6">
				保留数量，其它余售出：
					<input type="text" name="num" style="width:80" value="0"/>
				售出价格： <input type="text" name="saleprice1" style="width:80" value="0"/>
				<input type="button" value="确认售出" id="stockSale2"/> 
		    </td>
		</tr>
	</table>
</form>
<div class="EpmsSubTitle"><p><b>数据列表</b></p>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="EpmsTable">
  <tr>
	  <td class=EpmsTdTitle>选择</td>
	  <td class=EpmsTdTitle>排名</td>
	  <td class=EpmsTdTitle>用户名</td>
	  <td class=EpmsTdTitle>剩余股数</td>
	  
  </tr>
	<c:forEach var="stock" items="${page.result }" varStatus="index">
		<tr>
		    <td class=EpmsTdNoColor ><input type="checkbox" name="userx" value="${stock.userId }"></td>
		    <td class=EpmsTdNoColor >${index.index+1 }</td>
			<td class=EpmsTdNoColor >${stock.userId }</td>
			<td class=EpmsTdNoColor >${stock.stockNum }</td>
		</tr>
	</c:forEach>
	<tr>
		<td class="EpmsTdNoColor" colspan="9" align="right">
			<a href="javascript:void(0);" style="text-decoration: none;">
				<span onclick="frontpage(${page.pageNo-1})">上一页</span>&nbsp;
			</a>
			<a href="javascript:void(0);" style="text-decoration: none;">
				<span onclick="nextpage(${page.pageNo+1})">下一页</span> &nbsp;
			</a>
		</td>
	</tr>
</table>
<script>
	$("#stockSale1").click(function(){
		var userx = $("input[name=userx]").filter(":checked");
		if(userx.size() == 0){
			alert("请选择用户后操作。");
			return;
		}
		var userids = "";
		userx.each(function(){
			userids = userids + "," + $(this).val();
		});
		
		if(window.confirm("确认进行此操作吗？")){
			var form = $("#stockSBForm");
			form.attr("action","sale1.action?userids="+userids);
			form[0].submit();
		}
	});
	
	$("#stockSale2").click(function(){
		var userx = $("input[name=userx]").filter(":checked");
		if(userx.size() == 0){
			alert("请选择用户后操作。");
			return;
		}
		var userids = "";
		userx.each(function(){
			userids = userids + "," + $(this).val();
		});
		if(window.confirm("确认进行此操作吗？")){
			var form = $("#stockSBForm");
			form.attr("action","sale2.action?userids="+userids);
			form[0].submit();
		}
	});
	
	function frontpage(pageNo){
		var form = $("#stockSBForm");
		form.attr("action","listNum.action?pageNo="+pageNo);
		form[0].submit();
	}

	function nextpage(pageNo){
		var form = $("#stockSBForm");
		form.attr("action","listNum.action?pageNo="+pageNo);
		form[0].submit();
	}
</script>